<?php
JunctionFileCabinet::using("Test_Mock_Client");

JunctionFileCabinet::package("Junction_Utils");
JunctionFileCabinet::package("Junction_Utils_Reflection");

class Test_Junction_Utils_Reflection_Facade extends UnitTestCase {
	
	public function testCreate() {
		$map = Junction_Utils_Reflection_Facade::getInstance("Junction_Utils_HashMap", array());
		$this->assertTrue(is_a($map, "Junction_Utils_HashMap"));
	}
	
	public function testInvalidCreate() {
		try {
			Junction_Utils_Reflection_Facade::getInstance("Junction_Utils_HashMap", array(1, 3, 4));
		} catch (Junction_Utils_Reflection_Exception $e) {
			$this->pass();
		} catch (Exception $e) {
			$this->fail();
		}
	}
	
	public function testInvoke() {
		$map = new Junction_Utils_HashMap();
		Junction_Utils_Reflection_Facade::invokeArgs($map, "put", array("foo", "bar"));
		$this->assertTrue($map->get("foo") == "bar");
	}
	
	public function testInvalidInvoke() {
		try {
			$map = new Junction_Utils_HashMap();
			Junction_Utils_Reflection_Facade::invokeArgs($map, "put", array());	
		} catch (Junction_Utils_Reflection_Exception $e) {
			$this->pass();
		} catch (Exception $e) {
			$this->fail();
		}
	}
}
?>